#ifndef LOGICMANAGER_H
#define LOGICMANAGER_H

#include "dataDefination.h"
#include "xmlHandle.h"

#include <QList>
#include <QObject>

class QTimer;

class LogicManager : public QObject
{
    Q_OBJECT
public:
    explicit LogicManager(QObject *parent = 0);
    ~LogicManager();

private:
    void broadcastUserList();
    int finderUserIndex(const QString & ip);

signals:
    //for network
    void sendData(const QString & ip, const QByteArray & data);	//onSendData
    void sendLogout(const QString & ip);	//onCloseAll

public slots:
    //for network
    void onReceivedData(const QString & ip, const QByteArray & data);	//recieveData
    void onNotify(const QString & ip, int code);	//notify

private slots:
    void onSendLogin(QString ip, QString name);
    void onSendLogout(QString ip);
    void onSendPulse(QString ip);
    void onPluseTimeout();

private:
    QHash<QTimer *, int> * mHash;
    QList<userInfo> * mUserList;
    QList<QTimer *> * mTimerList;
    QByteArray * mXmlData;
    xmlHandle * mXml;

};
#endif // LOGICMANAGER_H
